﻿using System;
using LuaInterface;

public class UEngine_GameEventParamWrap
{
	public static void Register(IntPtr L)
	{
		LuaMethod[] regs = new LuaMethod[]
		{
			new LuaMethod("New", _CreateUEngine_GameEventParam),
			new LuaMethod("GetClassType", GetClassType),
		};

		LuaField[] fields = new LuaField[]
		{
			new LuaField("code", get_code, set_code),
			new LuaField("data", get_data, set_data),
			new LuaField("arg0", get_arg0, set_arg0),
			new LuaField("arg1", get_arg1, set_arg1),
		};

		LuaScriptMgr.RegisterLib(L, "UEngine.GameEventParam", typeof(UEngine.GameEventParam), regs, fields, null);
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int _CreateUEngine_GameEventParam(IntPtr L)
	{
		int count = LuaDLL.lua_gettop(L);

		if (count == 1)
		{
			int arg0 = (int)LuaScriptMgr.GetNumber(L, 1);
			UEngine.GameEventParam obj = new UEngine.GameEventParam(arg0);
			LuaScriptMgr.PushValue(L, obj);
			return 1;
		}
		else if (count == 2)
		{
			int arg0 = (int)LuaScriptMgr.GetNumber(L, 1);
			object arg1 = LuaScriptMgr.GetVarObject(L, 2);
			UEngine.GameEventParam obj = new UEngine.GameEventParam(arg0,arg1);
			LuaScriptMgr.PushValue(L, obj);
			return 1;
		}
		else if (count == 3)
		{
			int arg0 = (int)LuaScriptMgr.GetNumber(L, 1);
			string arg1 = LuaScriptMgr.GetString(L, 2);
			object arg2 = LuaScriptMgr.GetVarObject(L, 3);
			UEngine.GameEventParam obj = new UEngine.GameEventParam(arg0,arg1,arg2);
			LuaScriptMgr.PushValue(L, obj);
			return 1;
		}
		else if (count == 4)
		{
			int arg0 = (int)LuaScriptMgr.GetNumber(L, 1);
			string arg1 = LuaScriptMgr.GetString(L, 2);
			string arg2 = LuaScriptMgr.GetString(L, 3);
			object arg3 = LuaScriptMgr.GetVarObject(L, 4);
			UEngine.GameEventParam obj = new UEngine.GameEventParam(arg0,arg1,arg2,arg3);
			LuaScriptMgr.PushValue(L, obj);
			return 1;
		}
		else if (count == 0)
		{
			UEngine.GameEventParam obj = new UEngine.GameEventParam();
			LuaScriptMgr.PushValue(L, obj);
			return 1;
		}
		else
		{
			LuaDLL.luaL_error(L, "invalid arguments to method: UEngine.GameEventParam.New");
		}

		return 0;
	}

	static Type classType = typeof(UEngine.GameEventParam);

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int GetClassType(IntPtr L)
	{
		LuaScriptMgr.Push(L, classType);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_code(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);

		if (o == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name code");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index code on a nil value");
			}
		}

		UEngine.GameEventParam obj = (UEngine.GameEventParam)o;
		LuaScriptMgr.Push(L, obj.code);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_data(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);

		if (o == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name data");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index data on a nil value");
			}
		}

		UEngine.GameEventParam obj = (UEngine.GameEventParam)o;
		LuaScriptMgr.PushVarObject(L, obj.data);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_arg0(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);

		if (o == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name arg0");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index arg0 on a nil value");
			}
		}

		UEngine.GameEventParam obj = (UEngine.GameEventParam)o;
		LuaScriptMgr.Push(L, obj.arg0);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_arg1(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);

		if (o == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name arg1");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index arg1 on a nil value");
			}
		}

		UEngine.GameEventParam obj = (UEngine.GameEventParam)o;
		LuaScriptMgr.Push(L, obj.arg1);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int set_code(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);

		if (o == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name code");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index code on a nil value");
			}
		}

		UEngine.GameEventParam obj = (UEngine.GameEventParam)o;
		obj.code = (int)LuaScriptMgr.GetNumber(L, 3);
		LuaScriptMgr.SetValueObject(L, 1, obj);
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int set_data(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);

		if (o == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name data");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index data on a nil value");
			}
		}

		UEngine.GameEventParam obj = (UEngine.GameEventParam)o;
		obj.data = LuaScriptMgr.GetVarObject(L, 3);
		LuaScriptMgr.SetValueObject(L, 1, obj);
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int set_arg0(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);

		if (o == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name arg0");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index arg0 on a nil value");
			}
		}

		UEngine.GameEventParam obj = (UEngine.GameEventParam)o;
		obj.arg0 = LuaScriptMgr.GetString(L, 3);
		LuaScriptMgr.SetValueObject(L, 1, obj);
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int set_arg1(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);

		if (o == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name arg1");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index arg1 on a nil value");
			}
		}

		UEngine.GameEventParam obj = (UEngine.GameEventParam)o;
		obj.arg1 = LuaScriptMgr.GetString(L, 3);
		LuaScriptMgr.SetValueObject(L, 1, obj);
		return 0;
	}
}

